<?php
/*
Copyright (C) 2009 de Flotte Maxence

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
?>
<?php
/**
 * 2RM :: Unuseful file
 */
//Bibliothèque principale de puZZle

	//On démarre la session;
	//session_start();

//Fichier de configuration
include_once './ZzL/Right.php';
/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

		FONCTIONS DE CODAGE

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/
//Generation d'un fichier ZzS
function loadZzS($FileZzS) {
	$FZzS = './ZzS/'.$FileZzS.'.ZzS';
	$ZzS = file_get_contents($FZzS);
	$dateS = filemtime($FZzS);

	$FZzG = './ZzG/'.$FileZzS.'.php';
	if(file_exists($FZzG)) {
		$ZzG =	file_get_contents($FZzG);
		$dateG = filemtime($FZzG);
	}
	else {
		$dateG = -1;
	}

	if($dateG < $dateS) {
		include 'genZzS.php';
		genZzG2($ZzS,$FileZzS);
	}
	else
		include './ZzG/'.$FileZzS.'.php';
}

//Chargement d'un label
function loadLabel() {
	$arrayLid = explode('-',$_GET['label']);
	if(!is_numeric($arrayLid[0])) $_GET['altPuZZle'] = 1;
	$altPuzzle = isSet($_GET['altPuZZle']);
		
	$lang = ($_SESSION['lang'])?$_SESSION['lang']:'default';
	$cache = new ZzCache($arrayLid,$altPuzzle,$lang);
	$cache->open();
	//On regarde si c'est le puZZle alternatif
		/*if(!isSet($_GET['altPuZZle'])) {
			$_GET['altPuZZle'] = 'false';
		}
		elseif($_GET['altPuZZle'] != 'true' and $_GET['altPuZZle'] != '') {
			$_GET['altPuZZle'] = 'false';
		}
		else
			$_GET['altPuZZle'] = 'true';

	//On récupère le nom du fichier cache
		ksort($_GET);
		$get = null;
		foreach($_GET as $key => $value)
			if($key == 'label')
				$label = $value;
			elseif(($key == 'page' or $key == 'altPuZZle') and !empty($value))
				$get .= $key.'_'.$value.'-';
		if(!empty($_SESSION['lang'])) 
			$get .= 'lang_'.$_SESSION['lang'];
		else
			$get .= 'lang_default';

		//On récupère le label courent
		$_label = explode('-',$label);
		$label = $_label[0];
	 
		//On récupère la liste des labels parent 
		$parentLabel = null;
		foreach($_label as $key => $arg) {
			if($key == 1)
				$parentLabel .= $arg;
			elseif($key != 0)
				$parentLabel .= '-'.$arg;
		}
*/
	
	 //$ZZG = './ZzG/'.$label.'/'.$parentLabel.'_'.$get.'.php';

	//On regarde si le fichier cache existe
	//if(file_exists($ZZG)) {
	//	include($ZZG);
	//}
	//else {
	//	include 'generation.php';
	//	genZzG($label,$ZZG);
	//}
}
?>